# 自动收集所有.cpp和.h文件（递归子目录）
file(GLOB_RECURSE SOURCES "*.cpp" "*.c")
file(GLOB_RECURSE HEADERS "*.h" "*.hpp")

message(STATUS "🍭sensor_module 开始构建")


add_library(sensor_module STATIC ${SOURCES})



target_include_directories(sensor_module PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/ # 添加当前文件目录
    ${CMAKE_SOURCE_DIR}/config # 访问根目录生成的Config.h
)

target_link_libraries(sensor_module PUBLIC yj_common_module)
target_link_libraries(sensor_module PUBLIC rs485_module)
target_link_libraries(sensor_module PUBLIC agile_modbus_module)
target_link_libraries(sensor_module PUBLIC i2c_module)
target_link_libraries(sensor_module PUBLIC spi_module)

# 链接libgoogle-glog库
find_library(GLOG_LIBRARY NAMES glog)

if(NOT GLOG_LIBRARY)
    message(FATAL_ERROR "glog library not found. Please install libgoogle-glog-dev package")
endif()

target_link_libraries(sensor_module
    PRIVATE
    ${GLOG_LIBRARY}
)

# add_executable(vit_hwt901_test ./vit_hwt901_test.cpp )

# # 添加公共头文件路径
# target_include_directories(vit_hwt901_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)

# target_link_libraries(vit_hwt901_test PRIVATE sensor_module)

# add_executable(vit_wtvb02_test ./vit_wtvb02_test.cpp )

# # 添加公共头文件路径
# target_include_directories(vit_wtvb02_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)
    
# target_link_libraries(vit_wtvb02_test PRIVATE sensor_module)

# add_executable(vs_rea_xx_test ./vs_rea_xx_test.cpp )
# # 添加公共头文件路径
# target_include_directories(vs_rea_xx_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)
    
# target_link_libraries(vs_rea_xx_test PRIVATE sensor_module)

# add_executable(myantenna_laser_test ./myantenna_laser_test.cpp )
# # 添加公共头文件路径
# target_include_directories(myantenna_laser_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)
    
# target_link_libraries(myantenna_laser_test PRIVATE sensor_module)

# add_executable(hk_sht30_test ./hk_sht30_test.cpp )
# # 添加公共头文件路径
# target_include_directories(hk_sht30_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)
    
# target_link_libraries(hk_sht30_test PRIVATE sensor_module)

# add_executable(tpa626_test ./tpa626_test.cpp )
# # 添加公共头文件路径
# target_include_directories(tpa626_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)
    
# target_link_libraries(tpa626_test PRIVATE sensor_module)

# add_executable(hwt101_test ./hwt101_test.cpp )
# # 添加公共头文件路径
# target_include_directories(hwt101_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)
    
# target_link_libraries(hwt101_test PRIVATE sensor_module)

# add_executable(pmw3901_test ./pmw3901_test.cpp )
# # 添加公共头文件路径
# target_include_directories(pmw3901_test PRIVATE
#     ${CMAKE_CURRENT_BINARY_DIR}/include
#     ${CMAKE_CURRENT_BINARY_DIR}/
#     ${CMAKE_SOURCE_DIR}/config)
    
# target_link_libraries(pmw3901_test PRIVATE sensor_module)